package de.projectgoodmorning.activities;

import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.Smoke;

import com.jayway.android.robotium.solo.Solo;

import de.projectgoodmorning.alarm.activities.MainActivity;
import de.projectgoodmorning.alarm.activities.ManageAlarmActivity;
import de.projectgoodmorning.alarm.activities.SettingsActivity;

public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

	private Solo solo;
	
	public MainActivityTest() {
		super( MainActivity.class );
	}

 	public void setUp() throws Exception {
		solo = new Solo( getInstrumentation(), getActivity() );
	}
 	
 	@Smoke
 	public void test_it_should_create_a_new_alarm() {
		solo.clickOnButton( 0 );
		solo.assertCurrentActivity( "", ManageAlarmActivity.class );
		
		solo.enterText( 0, "Testalarm" );
		solo.clickOnButton( "07:00 Uhr" );
		
		solo.enterText( 0, "8" );
		solo.clickOnButton( "Fertig" );
		
		solo.clickOnButton( "Speichern" );
		solo.assertCurrentActivity( "", MainActivity.class );
 	}
 	
 	@Smoke
 	public void test_it_should_go_to_settings_and_leave() {
 		solo.clickOnButton( 1 );
 		solo.assertCurrentActivity( "", SettingsActivity.class );
 		
 		solo.clickOnButton( 0 );
 		solo.assertCurrentActivity( "", MainActivity.class );
 	}
 	
 	@Smoke
 	public void test_it_should_start_bluetooth() {
 		solo.clickOnButton( 2 );
 	}
}
